package csc420groupproject;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JTextField;

public class CustomKeyListener implements KeyListener{

    public void keyTyped(KeyEvent e) {
    }

    public void keyPressed(KeyEvent e) {
    }

    public void keyReleased(KeyEvent e) {
        if(e.getKeyCode() == e.VK_ENTER){
            //System.out.println("enter pressed");

            if(e.getSource() instanceof JTextField){
                JTextField source = (JTextField) e.getSource();
                GUI gui = (GUI) source.getTopLevelAncestor();

                gui.copyFromFormulaBarToMainArea();
            }
        }
    }

}
